package com.xia.util.exception;

import com.xia.util.common.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 异常处理类
 */
@ControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(ServiceException.class)
    @ResponseBody
    public Result handler(ServiceException serviceException){
        return Result.error(CodeEnum.CODE_400,serviceException.getMessage());
    }
}
